package com.zut.questionnaire.controller;

import com.zut.questionnaire.pojo.Question;
import com.zut.questionnaire.pojo.Result;
import com.zut.questionnaire.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("question")
public class QuestionController {

    @Autowired
    private QuestionService questionService;

    @PostMapping
    public Result save(@RequestBody Question question){

        return questionService.save(question);
    }

    @PutMapping("{id}")
    public Result update(@PathVariable String id,@RequestBody Question question){

        return questionService.update(id,question);
    }

    @DeleteMapping("{id}")
    public Result delete(@PathVariable String id){

        return questionService.delete(id);
    }
}
